import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '@/views/HomePage.vue'
import LoginPage from '@/views/login/LoginPage.vue'
import AdminPage from '@/views/AdminPage.vue'
import NotFound from '@/components/NotFound.vue'

const routes = [
    {
        path: '/',
        name: 'Home',
        component: HomePage,
    },
    {
        path: '/login',
        name: 'Login',
        component: LoginPage,
    },
    {
        path: '/admin',
        name: 'Admin',
        component: AdminPage,
    },
    {
        path: '/:catchAll(.*)', // 捕获所有未匹配的路由
        name: 'NotFound',
        component: NotFound, // 显示 404 组件
    },
];

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes,
});

export default router;
